package com.jspxcms.plug.repository;

import com.jspxcms.common.orm.Limitable;
import com.jspxcms.plug.domain.PlugDoctorDisease;
import com.jspxcms.plug.domain.PlugDoctorDiseasePK;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;

import java.util.Collection;
import java.util.List;

public interface PlugDoctorDiseaseDao extends Repository<PlugDoctorDisease, PlugDoctorDiseasePK>,PlugDoctorDiseaseDaoPlus {

    public PlugDoctorDisease save(PlugDoctorDisease bean);

    // --------------------

    @Modifying
    @Query("delete from PlugDoctorDisease bean where bean.fDoctorId in (?1)")
    public int deleteByDoctorIds(Collection<Integer> doctorIds);

    @Query("from PlugDoctorDisease a where a.fDoctorId = ?1")
    public List<PlugDoctorDisease> findByDoctorId(Integer fDoctorId);

}
